import logging
import pylons

from authentifications.lib.base import *
from paste.request import construct_url

log = logging.getLogger(__name__)

class PrivateController(BaseController):

    def index(self):
        # Return a rendered template
        #   return render('/some/template.mako')
        # or, Return a response
        if request.environ.get("REMOTE_USER"):
            return render("/private.mako")
        else:
            response = pylons.Response("You are not authenticated")
            response.status_code = 401
            return response
          
    def signout(self, environ):
        c.action = construct_url(environ)
        h.redirect_to(controller="/home")
        
    def signin(self):
        return render("/auth/form.mako")
        #h.redirect_to(controller="/home")